<template>
  <div>
    <!-- 头部NavBar -->
    <div class="navBarBox">
      <NavBar title="登录" routerLink="/users">
        <div></div>
      </NavBar>
    </div>
    <div @click="layout" style="margin: 16px">
      <van-button round block type="primary" native-type="submit">
        退出登录
      </van-button>
    </div>
  </div>
</template>

<script>
import NavBar from "@/components/NavBar/NavBar.vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
export default {
  components: { NavBar },
  setup() {
    const store = useStore();
    const router = useRouter();
    //   退出登录
    const layout = () => {
      //  清除token消息
      store.commit("user/setUser", {});
      router.push("/users");
    };
    return {
      layout,
    };
  },
};
</script>

<style lang="less" scoped>
// 按钮
// .van-button {
//   width: 90%;
//   margin: 2rem auto 1rem;
//   background-color: aliceblue;
//   color: sandybrown;
//   font-size: 1.3rem;
//   letter-spacing: 9px;
// }
</style>
